package com.doctcloud.datacloud.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.doctcloud.common.core.annotation.Excel;
import com.doctcloud.common.core.annotation.NotZero;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.*;

import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;

import static com.doctcloud.common.core.utils.StringUtils.trim;

@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
@EqualsAndHashCode(of = {"visitDate","visitNo"})
@TableName("outp_order_desc")
public class OutpOrdersDescEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Excel(name="就诊时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @NotNull
    private Date visitDate;
    @Excel(name="就诊序号")
    @NotZero(message = "就诊序号不得为空或0")
    private Integer visitNo;
    @Excel(name = "患者ID")
    @NotBlank(message = "患者ID不得为空")
    private String patientId;
    @Excel(name = "开单科室代码")
    @NotBlank(message = "开单科室代码不得为空")
    private String orderedByDept;
    private String orderedByDoctor;
    @Excel(name = "收费单据号")
    @NotBlank(message = "收费单据号")
    private String rcptNo;

    @Data
    public static class Key {
        private final Date visitDate;
        private final Integer visitNo;

        public Key(Date visitDate, Integer visitNo) {
            this.visitDate = visitDate;
            this.visitNo = visitNo;
        }
    }

    public void setOrderedByDoctor(String orderedByDoctor) { this.orderedByDoctor = trim(orderedByDoctor); }
}
